package weather.dictionary;

import weather.language.forecast.*;
import weather.util.dictionary.*;

public class ConditionGroupsDictionary extends
		AbstractGroupingDictionary<ConditionsGroup, Condition>
{
	public static ConditionGroupsDictionary instance()
	{
		if (instance == null)
			instance = new ConditionGroupsDictionary();
		return instance;
	}

	@Override
	public boolean elementBelongsToGroup(Condition element,
			ConditionsGroup group)
	{
		return element.belongsToGroup(group);
	}

	@Override
	public boolean groupContainsElement(ConditionsGroup group, Condition element)
	{
		return group.containsCondition(element);
	}

	@Override
	protected void addToGroup(Condition element, ConditionsGroup group)
	{
		element.addToGroup(group);
	}
	
	@Override
	protected Condition newElement(String s)
	{
		return new Condition(ConditionsDictionary.instance().getValue(s));
	}

	@Override
	protected ConditionsGroup newGroup(String s)
	{
		return new ConditionsGroup(s, WeatherKeywordsDictionary.instance().getEntriesEquivalentToEntry(s));
	}
	
	private ConditionGroupsDictionary() {}
	
	private static ConditionGroupsDictionary instance;
}
